﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Runtime.Serialization;

namespace FlightSearchServer
{
    [DataContract]
    class SearchServer
    {
        public SearchServer()
        {
            HasReplicationOf = new ServersCollection( );
            ReplicatedAt = new ServersCollection( ); 
        }

        [DataMember]
        public string Endpoint { set; get; }

        [DataMember]
        public string Name { set; get; }

        [DataMember]
        public string Alliance { set; get; }

        [DataMember]
        public ServersCollection HasReplicationOf
        {
            set;
            get;
        }

        [DataMember]
        public ServersCollection ReplicatedAt { set; get; }

        public bool Failed { set; get; }

        public override bool Equals(object obj)
        {
            SearchServer server = (SearchServer)obj;
            return Name.Equals( server.Name) &&
                Alliance.Equals( server.Alliance);
        }
    }
}
